package client.domain.ui.centerPanel;

import client.internationalization.SandboxConstants;
import client.internationalization.SandboxMessages;
import com.google.gwt.core.client.GWT;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.core.ExtElement;
import com.gwtext.client.core.RegionPosition;
import com.gwtext.client.widgets.*;
import com.gwtext.client.widgets.layout.BorderLayoutData;
import com.gwtext.client.widgets.layout.FitLayout;

/**
 * User: nbarrios
 * Date: Nov 9, 2009
 */
public class CenterPanel extends Panel {


	//	Internationalization Strings
	private SandboxConstants constants = GWT.create(SandboxConstants.class);
	private SandboxMessages messages = GWT.create(SandboxMessages.class);

	//	Main Widgets
	private static TabPanel tabPanel = new TabPanel();
	private com.gwtext.client.widgets.Window selectTabsToAddWindow;

	private BorderLayoutData centerData;

	// Constructor
	public CenterPanel() {

		this.setTitle(constants.centerPanelTitle());
		this.setLayout(new FitLayout());
		this.setHideBorders(true);
		this.setClosable(false);
		this.addTool(new Tool(Tool.PLUS, new ToolHandler(){
			public void onClick(EventObject e, ExtElement toolEl, Panel panel) {
				selectTabsToAddWindow = new SelectTabsToAddPopUp();
				selectTabsToAddWindow.show();
			}
		}));

		centerData = new BorderLayoutData(RegionPosition.CENTER);

		tabPanel.add(new HomeUI());
		tabPanel.add(new ChartUI());
//		tabPanel.add(new MapUI());

		tabPanel.setActiveTab(1);


		this.add(tabPanel);
	}

	//  Getters & Setters
	public BorderLayoutData getCenterData() {
		return centerData;
	}

	public void setCenterData(BorderLayoutData centerData) {

		this.centerData = centerData;
	}

	public TabPanel getTabPanel() {
		return tabPanel;
	}

	public void setTabPanel(TabPanel tabPanel) {
		CenterPanel.tabPanel = tabPanel;
	}
}
